$(function() {
	var param = getUrlParameters();
	var userId = param.userId || "";
	var homeUserNo = param.homeUserNo || "";
	$.ajax({
		url : preUrl + "applyInfo/businessRepair",
		type : "POST",
		dataType : "json",
		data : {
			"homeUserNo" : homeUserNo,
			applyUserId:userId
		},
		success : function(data) {
			if (data.rspCode == "0002") {
				alert(data.rspMsg);
				return;
			} else if (data.rspCode == "0000") {
				var temp ="";
				var year = "";
				$.each(data.data,function(key,applyInfo){
					var status = "";
					switch (applyInfo.applyStatus) {
					case '01':
						status = "待受理";
						break;
					case '02':
						status = "已受理";
						break;
					case '03':
						status = "已完结";
						break;
					default:
						break;
					}
					
					var type = "";
					switch (applyInfo.applyType) {
					case '01':
						type = "新户报装";
						break;
					case '02':
						type = "故障报修";
						break;
					case '03':
						type = "水表检测";
						break;
					case '04':
						type = "用户销户";
						break;
					default:
						break;
					}
					var now = new Date(applyInfo.applyDate);
					if (year != now.getFullYear() ) {
						temp = $("#template").clone().removeAttr("id").show();
						temp.find(".deal-list").html("");
						temp.find(".time").text(now.getFullYear()+"年");
						$("#buinessList").append(temp);
					}
					year=now.getFullYear();
					var dealTemp=$("#dealTemp").clone().removeAttr("id");
					dealTemp.find(".rg-ch").html(type);
					dealTemp.find(".rg-en").html(status);
					dealTemp.find(".de-lf").html(((now.getMonth() + 1) < 10 ? "0" : "")
							+ (now.getMonth() + 1)+"."+
							(now.getDate() < 10 ? "0" : "") + now.getDate());
					temp.find(".deal-list").append(dealTemp);
				});
			}
		},
		error : function(data) {
			alert("服务器繁忙 稍后重试！");
			return;
		}
	});
});